import 'package:flutter/material.dart';

class SplashPage1 extends StatefulWidget {
  @override
  _SplashPage1State createState() => _SplashPage1State();
}

class _SplashPage1State extends State<SplashPage1>
    with SingleTickerProviderStateMixin {
  AnimationController controller;
  CurvedAnimation curvedAnimation;
  @override
  void initState() {
    super.initState();
    controller = AnimationController(
        duration: Duration(milliseconds: 2000), vsync: this);
    curvedAnimation = CurvedAnimation(parent: controller, curve: Curves.easeIn);
    controller.forward();
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      child: FadeTransition(
        opacity: Tween(begin: 0.0, end: 1.0).animate(curvedAnimation),
        child: Stack(
          alignment: FractionalOffset(0.5, 0.9),
          children: <Widget>[
            Positioned(
              child: Container(
                color: Colors.black,
                width: double.infinity,
                height: double.infinity,
                child: Image.network(
                  "https://source.nullno.com/images/sp3.jpg",
                  fit: BoxFit.cover,
                ),
              ),
            ),
            Positioned(
              child: Container(
                color: Colors.black54,
                width: double.infinity,
                height: double.infinity,
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: <Widget>[
                    SlideTransition(
                      position:
                          Tween(begin: Offset(0.0, -0.5), end: Offset(0.0, 0.0))
                              .animate(curvedAnimation),
                      child: Text(
                        'Music',
                        style: TextStyle(
                            color: Colors.white,
                            fontSize: 50.0,
                            fontWeight: FontWeight.bold,
                            decoration: TextDecoration.none),
                      ),
                    ),
                    SizeTransition(
                      axis: Axis.horizontal,
                      sizeFactor:
                          Tween(begin: 0.1, end: 1.0).animate(curvedAnimation),
                      child: Container(
                        width: 300,
                        height: 3,
                        decoration: BoxDecoration(
                            border: Border.all(color: Colors.white, width: 2),
                            borderRadius: BorderRadius.circular(10.0)),
                      ),
                    ),
                    SlideTransition(
                      position:
                          Tween(begin: Offset(0.0, 0.5), end: Offset(0.0, 0.0))
                              .animate(curvedAnimation),
                      child: Text("neteast",
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: 20.0,
                              decoration: TextDecoration.none)),
                    ),
                  ],
                ),
              ),
            ),

            Positioned(
              child: RaisedButton(
                onPressed: (){
                  print("loading");
                },
                color: Colors.greenAccent,
                splashColor: Colors.black54,
                elevation: 0.0,
                highlightElevation: 0.0,
                padding: EdgeInsets.fromLTRB(50, 10, 50, 10),
                shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(22.0))),
                child: Text("Load in",style: TextStyle(color: Colors.white,fontSize: 16),textAlign:TextAlign.center,),
              ),
            ),
          ],
        ),
      ),
    );
  }

  @override
  void dispose() { 
    controller.dispose();
    super.dispose();
  }
}
